//
//  CSMapSearchListCell.swift
//  Cycling
//
//  Created by CSS on 4/1/23.
//

import UIKit

class CSMapSearchListCell: UITableViewCell {

    @IBOutlet private weak var titleLbl: UILabel!
    @IBOutlet private weak var typeImgView: UIImageView!
    @IBOutlet private weak var typeLbl: UILabel!
    @IBOutlet private weak var moreLbl: UILabel!
    
    public var model: CSSearchResultModel? {
        didSet {
            titleLbl.text = model?.name
            typeImgView.image = model?.type.typeIconImage
            typeLbl.text = model?.type.typeString
            typeLbl.textColor = model?.type.typeColor
            
            valueShow(withType: 0)
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        selectionStyle = .none
        backgroundColor = .clear
        
        addSegmentLine()
    }
    
    public func valueShow(withType type: Int) {
        moreLbl.isHidden = type == 0
        
        titleLbl.isHidden = !moreLbl.isHidden
        typeImgView.isHidden = titleLbl.isHidden
        typeLbl.isHidden = titleLbl.isHidden
    }
    
}
